#include <sqlite3.h>
#include <vector>
#include <string>
#include <iostream>
#include "building.h"
#include "json.hpp"
#include <fstream>
using namespace std;
using json = nlohmann::json;

vector<building> load_buildings(){

	vector<building> vector_building;
	vector_building.push_back(building());
	std::ifstream in("buildings.json");
	json j = json::parse(in);

	int i = 1;
	for(auto json_building : j["buildings"]){

		building o_building(json_building.at("name"), i);
		
		o_building.set_cost(json_building.at("cost"));
		
		o_building.set_building_time(json_building.at("building_time"));
		
		o_building.set_air_pollution(json_building.at("pollution"));
		
		o_building.set_max_people(json_building.at("max_people"));
		
		o_building.set_electricity_consumption(json_building.at("electricity_consumption"));
		
		o_building.set_water_consumption(json_building.at("water_consumption"));
		
		o_building.set_size(json_building.at("size"));
		
		o_building.set_deterioration_factor(json_building.at("deterioration_factor"));
		
		o_building.set_waste(json_building.at("waste"));
		
		vector_building.push_back(o_building);
		++i;
	}
	
	for(unsigned i = 0; i < vector_building.size(); ++i)
		cout << vector_building[i].get_type() << endl;
	
	return vector_building;
}
